<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- <link rel="stylesheet" href="http://xxxxxxx.css"> -->
</head>
<body>
  <!-- <img src="https://img0.baidu.com/it/u=3049689865,3958039471&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" alt=""> -->

  <!-- <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.js"></script> -->


  <!-- <script>
    const xhr = new XMLHttpRequest();
    xhr.open('GET', 'http://localhost:3000')
    xhr.send();
    xhr.onreadystatechange = function() {
      if (xhr.readyState === 4 && xhr.status === 200) {
        console.log(xhr.responseText);
        
      }
    }
  </script> -->



  <!-- <script src="http://localhost:3000?cb='callback'"></script> -->
  <script>
    function jsonp(url, cb) {
      return new Promise(function(resolve, reject) {
        const script = document.createElement('script');
        window[cb] = function(data) {   // callback()
          resolve(data)
        }

        script.src = `${url}?cb=${cb}`;
        document.body.appendChild(script);
      });
    }


    jsonp('http://localhost:3000', 'callback').then(res => {
      console.log(res);
    })
  </script>

</body>
</html>